Skip to main content

Invert

Check options and parameters of invert method

The invert filter is an image processing technique used to reverse the color values of an image, creating a negative or "inverted" version of the original. In this process, the darkest areas become the lightest, and the lightest areas become the darkest, while the midtones are adjusted accordingly. The invert filter is a simple but effective way to create visual contrast and produce interesting effects.

placeholderplaceholder
Ran in 0.00μs (Infinity ops/s)

Parameters and default values

  • options

Options

OptionDefault value
out-
Implementation

Here's how invert filter is implemented in ImageJS:

Pixel Transformation: For each pixel in the image, the inversion filter transforms its color intensity value. The new intensity value is calculated using the formula:

NewIntensity=MaxIntensityOriginalIntensityNew Intensity = Max Intensity - Original Intensity

Where "Max Intensity" is the maximum possible intensity value for the color channel.

danger

ImageJS uses components to calculate each pixel value and leaves alpha channel unchanged. For more information about channels and components visit this link.